﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Linq;

namespace MKDataBase.Contracts
{
    /// <summary>
    /// MovieManager Row
    /// </summary>
    public class MovieManagerDataRow
    {
        /// <summary>
        /// Gets or sets the movie ID.
        /// </summary>
        /// <value>
        /// The movie ID.
        /// </value>
        public int MovieID { get; set; }
        
        /// <summary>
        /// Gets or sets the name of the movie.
        /// </summary>
        /// <value>
        /// The name of the movie.
        /// </value>
        public string MovieName { get; set; }
        
        /// <summary>
        /// Gets or sets the movie location.
        /// </summary>
        /// <value>
        /// The movie location.
        /// </value>
        public string MoviePath { get; set; }

        /// <summary>
        /// Gets or sets the language.
        /// </summary>
        /// <value>
        /// The language.
        /// </value>
        public string Language { get; set; }

        /// <summary>
        /// Maps to SqlParameterCollection
        /// </summary>
        /// <returns></returns>
        public IList<SqlParameter> MapTo()
        {
            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter(@"MovieName", this.MovieName));
            parameters.Add(new SqlParameter(@"MoviePath", this.MoviePath));
            parameters.Add(new SqlParameter(@"Language", this.Language));
            return parameters;
        }

        public XElement MapToXml()
        {
            return new XElement("Movie",
                new XElement("MovieName", this.MovieName),
                new XElement("MoviePath", this.MoviePath),
                new XElement("Language", this.Language));
        }

    }
}
